/*
 * usbstatus.h
 *
 *  Created on: 2023��3��22��
 *      Author: xiejianming
 */

#ifndef TRUNK_INCLUDE_UVC_USBSTREAM_H_
#define TRUNK_INCLUDE_UVC_USBSTREAM_H_

#include <map>
#include <string>
#include <functional>
#include <mutex>
#include "UsbDevice.h"

namespace Usbstream{

using namespace std;

class UsbStream{
public:

	/**
	 *	��������(���캯��)
	 * */
	UsbStream();

	bool addStreamObject(int ability, int devicenum);

	bool removeStreamObject(int ability);

	/**
	 * ɾ����������������
	 * */
	~UsbStream();

	/**
	 * ������Ϣ��ȡ�����ﶼ��ʹ��MAP�ķ�ʽ��װ�ģ�����ֱ�ӷ���
	 * */
	bool getSupportParams(int ability, Json::Value &params);

	/**
	 * ���ö������Ϣ��Ҳ��ʹ��map�ķ�ʽ���ö������Ϣ����ͳһд
	 * */
	bool setParams(int ability, const Json::Value params);

	/**
	 * ���������֧�ֿ������ر��������ûص��Ȳ��������������ṩһ��write�ӿ�
	 * */
	bool startStream(int ability, callback_t cb);

	bool stopStream(int ability);


	bool writeStream(int ability, void *buffer, int length);

private:
	bool getOptObject(int ability, UsbDevice **optObject);

private:
	//���浱ǰ����
	UsbDevice 	*m_uacin;
	UsbDevice 	*m_uacout;
	UsbDevice 	*m_uvcin;
	int      	 m_enableablity;
	mutex		 m_streamLock;
};

}


#endif /* TRUNK_INCLUDE_UVC_USBSTREAM_H_ */
